package com.jie.entity;
import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDateTime;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.*;

import java.io.Serializable;
/**
 * <p>
 * 论坛评论表
 * </p>
 *
 * @author jie
 * @since 2024-05-29
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("comment")
public class Comment implements Serializable {
    private static final long serialVersionUID=1L;

    /**
     * 自增id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 评论目标实体类型
     */
    @TableField("target_type")
    private String targetType;
    /**
     *
     * 父评论id
     */
    @TableField("parent_id")
    private Integer parentId;
    /**
     * 评论内容
     */
    @TableField("comment_content")
    private String commentContent;

    /**
     * 评论用户id
     */
    @TableField("comment_uid")
    private Integer commentUid;

    /**
     * 回复用户id
     */
    @TableField("target_uid")
    private Integer targetUid;

    /**
     * 是否通过 (0否 1是)
     */
    @TableField("is_check")
    private Integer isCheck;

    /**
     * 被点赞数量
     */
    @TableField("like_count")
    private Integer likeCount;

    /**
     * 被评论数量
     */
    @TableField("commented_count")
    private Integer commentedCount;

    /**
     * 创建时间
     */
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    // 格式化
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    // 格式化
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(fill = FieldFill.UPDATE)
    private LocalDateTime updateTime;
}
